/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __KEY_H
#define __KEY_H

#include "gpio.h"

struct _key_t{
	GPIO_TypeDef  *GPIOx;
	uint16_t GPIO_PINx;
	GPIO_PinState downState;
	GPIO_PinState upState;
	GPIO_PinState lastState;	//上一次的按键状态，用于检测下降沿
	GPIO_PinState downFlag;		//是否按下过按键
};
	
void key_init(void);
void key_update(void);
uint8_t getkey(uint8_t keynum);
uint8_t getkey_state(uint8_t getkeynum);
uint8_t getkey_music(uint8_t getkeynum, uint16_t hz) ;
void funkey_check(void);

void key_led_show(void);
uint8_t getkey_led(uint8_t getkeynum);
#endif /* __KEY_H */

/******************* (H) COPYRIGHT 2023 LIUGHONG*****END OF FILE************/

